<template>

  <el-dialog
    title="这是一条提示信息"
    :visible="showDepa"
    :before-close="handleClose"
  ><el-form label-width="120px" :model="formData" :rules="rules">
     <el-form-item label="部门名称" prop="name">
       <el-input v-model="formData.name" style="width:80%" placeholder="1-50个字符" />
     </el-form-item>
     <el-form-item label="部门编码" prop="code">
       <el-input v-model="formData.code" style="width:80%" placeholder="1-50个字符" />
     </el-form-item>
     <el-form-item label="部门负责人" prop="manager">
       <el-select v-model="formData.manager" style="width:80%" placeholder="请选择" />
     </el-form-item>
     <el-form-item label="部门介绍" prop="introduce">
       <el-input v-model="formData.introduce" style="width:80%" placeholder="1-300个字符" type="textarea" :rows="3" />
     </el-form-item>
   </el-form>
    <!-- el-dialog有专门放置底部操作栏的 插槽  具名插槽 -->
    <el-row slot="footer" type="flex" justify="center">
      <!-- 列被分为24 -->
      <el-col :span="6">
        <el-button type="primary" size="small">确定</el-button>
        <el-button size="small">取消</el-button>
      </el-col>
    </el-row>
  </el-dialog>
</template>

<script>
export default {
  props: {
    showDepa: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      formData: {
        name: '', // 部门名称
        code: '', // 部门编码
        manager: '', // 部门管理者
        introduce: '' // 部门介绍
      },
      // 定义校验规则
      rules: {
        name: [{ required: true, message: '部门名称不能为空', trigger: 'blur' },
          { min: 1, max: 10, message: '部门名称要求1-10个字符', trigger: 'blur' }],
        code: [{ required: true, message: '部门编码不能为空', trigger: 'blur' },
          { min: 1, max: 10, message: '部门编码要求1-10个字符', trigger: 'blur' }],
        manager: [{ required: true, message: '部门负责人不能为空', trigger: 'blur' }],
        introduce: [{ required: true, message: '部门介绍不能为空', trigger: 'blur' },
          { trigger: 'blur', min: 1, max: 300, message: '部门介绍要求1-300个字符' }]
      }
    }
  },
  methods: {
    handleClose(done) {
    //   this.$confirm('确认关闭？')
    //     .then(_ => {
    //       done()
    //     })
    //     .catch(_ => {})
    }
  }
}
</script>

<style>

</style>
